package com.gc.web.controller.api;

import com.gc.business.domain.CompanyManage;
import com.gc.business.service.ICompanyManageService;
import com.gc.framework.web.base.ApiBaseController;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 公司管理 控制层
 * 
 * @author liujinteng
 * @date 2020-11-21
 */
@Slf4j
@Controller
@RequestMapping("/api/companyManage")
public class ApiCompanyManageController  extends ApiBaseController {

	@Autowired
	private ICompanyManageService companyManageService;

	/**
	 * 查看公司列表
	 *
	 */
	@GetMapping("/findCompanyManageList")
	@ResponseBody
	public Map<String, Object> findCommunityByToken(Integer pageNum,Integer pageSize) {
		startPage(pageNum,pageSize,"create_time DESC");
		List<CompanyManage> companyManageList = companyManageService.list(new CompanyManage());
		Map<String,Object> mapReturn = new HashMap<>();
		mapReturn.put("pageNum",pageNum);
		mapReturn.put("list",companyManageList);
		mapReturn.put("total",new PageInfo<>(companyManageList).getTotal());
		return success(mapReturn);
	}
}
